﻿using System;
using System.Collections.Generic;
using System.Text;
using Gtk;

namespace GtkSharpTutorial
{
    class RadioButtons
    {
        static GLib.SList group = null;

        static void exitbutton_event(object obj, EventArgs args)
        {
            Application.Quit();
        }

        public Widget GetButton()
        {

            VBox box1 = new VBox(false, 0);
            box1.Show();

            VBox box2 = new VBox(false, 10);
            box2.BorderWidth = 10;
            box1.PackStart(box2, true, true, 0);
            box2.Show();

            RadioButton radiobutton = new RadioButton(null, "button1");
            box2.PackStart(radiobutton, true, true, 0);
            radiobutton.Show();
            //var group = radiobutton.Group;
            RadioButton radiobutton2 = new RadioButton(radiobutton, "button2");
            radiobutton2.Active = true;
            box2.PackStart(radiobutton2, true, true, 0);
            radiobutton2.Show();

            //RadioButton radiobutton3 = RadioButton.NewWithLabel(radiobutton, "button3");
            var radiobutton3 = RadioButton.NewWithLabel("button3");

            box2.PackStart(radiobutton3, true, true, 0);
            radiobutton3.Show();

            HSeparator separator = new HSeparator();
            box1.PackStart(separator, false, true, 0);
            separator.Show();

            VBox box3 = new VBox(false, 10);
            box3.BorderWidth = 10;
            box1.PackStart(box3, false, true, 0);
            box3.Show();

            Button button = new Button("close");
            button.Clicked += exitbutton_event;

            box3.PackStart(button, true, true, 0);
            button.CanDefault = true;
            //button.GrabDefault();
            button.Show();


            return box1;
        }
    }
}
